/*
  ͨ���ƥ���㵿

  Copyleft JoStudio
*/
#include "string-util.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "stringx.h"


//****************patched by yagamishi add*************2016/02/05*******
/**
  * @brief      �õ��м�����ｿ
  * @param      arg1��string��arg2���ָ���
  * @retval     �õ��м�����̣��ָ������+1
  */
int getProcessNum(char * buf,const char *token){
	return containc(buf,token)+1;
}
/**
  * @brief      �õ�����ｿ
  * @param      arg1��string��arg2���ָ���,�м����ָ���
  * @retval     ���صõ��Ľ���ｿ
  */
char ** getProcessName(char * buf,const char *token,int tokenNum){
	char ** processList = NULL;
	processList = (char **)calloc(strlen(buf)-tokenNum, sizeof(char *));
	int i=0;
	char* tokenStr =strtok(buf, token);
	while(tokenStr != NULL){
		processList[i++]=strdup(tokenStr);
        tokenStr = strtok(NULL,token);
    }
	//****************patched by yagamishi add*************2016/02/06*******
	//***************************��Ϊstrtok���������һ���ַ����һλ16������d,��Ӧansi��cr��Ҫ�ĳ�0
	//i--;
	//processList[i][strlen(processList[i])-1]=0;
	//***************************************************************************
	return processList;
}
//************************************************************************

